package plus.xj17520.org.controller;

import plus.xj17520.basic.domain.AjaxResult;
import plus.xj17520.org.domain.RegisterDTO;
import plus.xj17520.org.service.IShopService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

@RestController
@RequestMapping("/shop")
public class ShopController {

    @Autowired
    IShopService shopService;

    /**
     * 1.url:/shop/register
     * 2.请求方式:post
     * 3.请求参数: 两个对象:Employee shop
     * 4.响应参数
     * @return
     */
    @PostMapping("register")
    public AjaxResult register(@RequestBody @Validated RegisterDTO dto){
        AjaxResult result = shopService.register(dto);
        return result;
    }

    @GetMapping("state/{uuid}")
    public AjaxResult state(@PathVariable String uuid){
        AjaxResult result = shopService.state(uuid);
        return result;
    }
}
